﻿
using DataDriven;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;

namespace DataService.Extensions
{
    public class SqliteExpression : ResolveExpress
    {
        //public override string Like(MethodCallExpression expression)
        //{
        //    string Result = string.Empty;
        //    if (expression.Arguments[0] is ConstantExpression)
        //    {
        //        //数据库字段.Contains("字符串值")
        //        object Temp_Vale = (expression.Arguments[0] as ConstantExpression).Value;
        //        string Value = string.Format(GetLikeNode(expression), Temp_Vale);
        //        Value = Value.Replace("%", "");
        //        string endText = UnicodeHelper.TranToEdnString(Value);

        //        string Name = (expression.Object as MemberExpression).Member.Name;

        //        string startName = Name + Guid.NewGuid().GetHashCode();
        //        string startCompName = SetArgument(startName, Value);


        //        string endName = Name + Guid.NewGuid().GetHashCode();
        //        string endCompName = SetArgument(endName, endText);


        //        Result = string.Format("{0}>={1} AND {2}>={3}", Name, startCompName, Name, endCompName);
        //        // Result = string.Format("{0} like {1}", Name, CompName);
        //    }
        //    if (expression.Arguments[0] is MemberExpression)
        //    {
        //        //数据库字段.Contains("字符串值")
        //        string Name = (expression.Object as MemberExpression).Member.Name;
        //        object Temp_Vale = GetMethodCallValue(expression);
        //        string Value = string.Format(GetLikeNode(expression), Temp_Vale);

        //        Value = Value.Replace("%", "");
        //        string endText = UnicodeHelper.TranToEdnString(Value);


        //        string startName = Name + Guid.NewGuid().GetHashCode();
        //        string startCompName = SetArgument(startName, Value);


        //        string endName = Name + Guid.NewGuid().GetHashCode();
        //        string endCompName = SetArgument(endName, endText);


        //        Result = string.Format("{0}>={1} AND {2}>={3}", Name, startCompName, Name, endCompName);
        //    }
        //    return Result;
        //}




    }
}
